//---------------------------------------------------------------------------

#ifndef GameH
#define GameH
#include<iostream>
#include "core/Boards.h"
#include <windows.h>
#include <gl/glut.h>
#include <gl/glaux.h>
#include <stdio.h>
#include <iostream>
using namespace std;
// keperluan gameplay
enum GameState { startmenu, gameplay, options, help, credits, highscore };
enum ThemeState { classic, unyu };
enum InputState { player1, player2 };

// region kerjaan mp
enum SelectPlayerState { pvp, pvc, cvc };
// endregion kerjaan mp

//gameplay
int turn;
int battleMode;
bool endGame;
bool enemyFront;
int currentCoin;
int comLevel;
History mHistory;
History myHistory;
string saveFile, loadFile;
bool initGame;

	 
// attributes
GameState gameState;
ThemeState themeState;
// region kerjaan mp
InputState inputState;
SelectPlayerState selectPlayerState;
// endregion kerjaan mp
Boards myCheckers;
int bidakPressed = 0; // 0 jika tidak ada bidak yang di pilih, 1-24 bila ada bidak yang terpilih sesuai dengan nomor bidaknya
int possibleAreaToMove[1][5];
int boardSize;
int coinSelected;

// kerjaan mp
History history;
string player1name;
string player2name;
int length;
int length1;
int length2;
// id dari texture tiap-tiap image yang di-draw
GLuint backgroundStartMenu_id;
GLuint backgroundGamePlay_id;
GLuint papan_id;
GLuint papanselected_id;
GLuint arah_id;
GLuint posibilitas_id;
GLuint bidak1_id;
GLuint bidak2_id;
GLuint bidak1_id_pressed;
GLuint bidak2_id_pressed;
GLuint backgroundHighScore_id;
GLuint backgroundOptions_id;
GLuint backgroundHelp_id;
GLuint backgroundCredits_id;
// region kerjaan mp
GLuint pvp_id;
GLuint pvc_id;
GLuint cvc_id;
// endregion kerjaan mp

// methods
Boards getBoards();
// melakukan pembacaan file bitmap
GLuint loadBMP(const char * filename);
void initGL();
void loadContent(ThemeState themeState);
void initialize();
float widthRatio(int width, int gameWidth);
float heightRatio(int height, int gameHeight);
void keyPressed(unsigned char key, int x, int y);
void mouseButton(int button, int state, int x, int y);
void updateGamePlay(void);
void drawStartMenu();
void drawBidak();
void drawOptions();
void drawGamePlay();
void drawHighScore();
void draw();
void drawBoardsFeatures();
void initregister();

void playerTurn();
void updateBoards();
void checkersRules();
int getCoinFromMouse(int x, int y);
void clearPossibleArea();
void comAIMovement(int *moveTo);
void confirmSave(); // menentukan apakah akan di save atau tidak sebelum meninggalkan permainan
void playerMovement(int *moveTo);
void comAIMovement(int *moveTo);
int* getAreaFromMouse(int x, int y);
//---------------------------------------------------------------------------
#endif
